if `int != 1` or `int == 0`?
Posted
by Emil
on Stack Overflow
See other posts from Stack Overflow
or by Emil
Published on 2010-06-07T20:21:15Z
Indexed on
2010/06/07
20:52 UTC
Read the original article
Hit count: 130
Hey.
I was coding here the other day, writing a couple of if statements with ints that are always either zero or one (~bools), and I asked myself:
Should I use if (int == 1)
or if (int != 0)
?
Is there any difference at all?
Please, don't answer with stuff regarding the int may being more/less than 1/0, that's not what I want to know.
© Stack Overflow or respective owner